<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 28700
  Date: 2022/6/11
  Time: 15:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>公司管理</title>
    <link rel="stylesheet" type="text/css" href="../../css/table.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/yes.css"/>
</head>
<body bgcolor="#f0f8ff">
<div class="form-item">
    <form action="/welcome" method="post">
        <input type="hidden" name="username" value="${username}">
        <button type="submit" value="返回">
            <span>返回</span>
        </button>
    </form>
</div>
<%--通过表单显示所有公司信息--%>
    <table>
        <caption>企业表</caption>
        <thead>
        <tr>
            <td>公司编号</td>
            <td>公司名</td>
            <td>公司地址</td>
            <td>公司电话</td>
        </tr>
        </thead>
        <tbody>
            <c:forEach items="${ep}" var="ep">
                <tr>
                    <td>
                            ${ep.id}
                    </td>
                    <td>
                            ${ep.name}
                    </td>
                    <td>
                            ${ep.place}
                    </td>
                    <td>
                            ${ep.tel}
                    </td>
                </tr>
            </c:forEach>
        </tbody>

    </table>
    <form action="/entadd" method="post">
        <input type="hidden" name="username" value="${username}">
        <div class="form-item">
            <label>公司名</label>
            <input type="text"
                   name="name"
                   class="text-input"
                   placeholder="请输入公司名称(3-20个中文)"
                   pattern="^[/u4e00-/u9fa5]{3,20}$"
                   oninput="setCustomValidity('')"
                   oninvalid="setCustomValidity('请输入合法的昵称>_<')"
                   required>
        </div>
        <div class="form-item">
            <label>公司电话</label>
            <input type="tel"
                   name="tel"
                   class="text-input"
                   placeholder="请输入负责人电话"
                   oninput="onPwdInput(event)"
                   required>
        </div>
        <div class="form-item">
            <label>公司地址</label>
            <input type="text"
                   name="place"
                   class="text-input"
                   placeholder="请输入公司地址(最多50个中文)"
                   pattern="^[ /u4e00-/u9fa5]{1,50}$"
                   required>
        </div>
        <button type="submit" value="add">
            <span>添加</span>
        </button>
    </form>
    <form action="/enterdel" method="post">
        <input type="hidden" name="username" value="${username}">
<%--        删除--%>

        <div class="form-item">
            <label>公司编号</label>
            <input type="text"
                   name="id"
                   class="text-input"
                   placeholder="请输入公司编号">
        </div>

        <button type="submit" value="del" name="method">
            <span>删除</span>
        </button>
    </form>
    <form method="post" action="/entupdate">
        <input type="hidden" name="username" value="${username}">
<%--        修改--%>
        <div class="form-item">
            <label>公司编号</label>
            <input type="text"
                   name="id"
                   class="text-input"
                   placeholder="请输入公司编号">
        </div>
        <div class="form-item">
            <label>公司名</label>
            <input type="text"
                   name="name"
                   class="text-input"
                   placeholder="请输入公司名称(3-20个中文)"
                   pattern="^[/u4e00-/u9fa5]{3,20}$"
                   oninput="setCustomValidity('')"
                   oninvalid="setCustomValidity('请输入合法的昵称>_<')"
                   required>
        </div>
        <div class="form-item">
            <label>公司电话</label>
            <input type="tel"
                   name="tel"
                   class="text-input"
                   placeholder="请输入负责人电话"
                   oninput="onPwdInput(event)"
                   required>
        </div>
        <div class="form-item">
            <label>公司地址</label>
            <input type="text"
                   name="place"
                   class="text-input"
                   placeholder="请输入公司地址(最多50个中文)"
                   pattern="^[ /u4e00-/u9fa5]{1,50}$"
                   required>
        </div>
        <button type="submit" value="update" name="method">
            <span>修改</span>
        </button>
    </form>
</body>
</html>
